//
// Created by 21577 on 2025/3/7.
//
#include<stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    int year = 2023, month = 9, day = 17;
    int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int sum = 0, count = 1;
    while (1) {
        days[2] = 28;
        day++;
        count++;
        sum += 31;
        if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
            days[2]++;
        }
        if (day > days[month]) {
            month++;
            sum += 30;
            day = 1;
        }
        if (month > 12) {
            year++;
            month = 1;
        }
        if (sum >= n)
            break;
    }
    printf("%d", count);
    return 0;
}
//    while(x--){
//        days[2]=28;
//        day++;
//        if((year%4==0&&year%100!=0)||year%400==0){
//            days[2]++;
//        }
//        if(day>days[month]){
//            month++;
//            day=1;
//        }
//        if(month>12){
//            year++;
//            month=1;
//        }
//    }
//    printf("%d %d %d",year,month,day);
